package jsyf.oa.dao.contract;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jsyf.oa.entity.contract.GuarantorEntity;
import jsyf.oa.idao.BaseDao;
import jsyf.oa.ientity.IBaseEntity;
import org.springframework.stereotype.Repository;

/**
 * Created by Maqiuqiu on 2018/6/20.
 */
@Repository
public class GuarantorDao extends BaseDao {

    public GuarantorDao() {
        super.iBaseEntity = new GuarantorEntity();
    }

    @Override
    public IBaseEntity convertJson2Entity(JSONObject json) {
        return JSON.toJavaObject(json, GuarantorEntity.class);
    }

    @Override
    public Integer removeByCondition(String condition, String[] params) {
        StringBuffer sql = new StringBuffer();
        sql.append(" UPDATE " + iBaseEntity.getTableName() + " SET LOG_FLAG=1 WHERE 1 = 1 ");
        sql.append(condition);
        return super.delete(sql.toString(), params);
    }
}
